package com.cn.Sevelt;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.cn.dao.Userdao;
@WebServlet(name="chengle",urlPatterns="/ajax")
public class Ajax extends HttpServlet {

	public void destroy() {
		super.destroy();
	}

	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
this.doPost(request, response);
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setCharacterEncoding("utf-8");
       String name=request.getParameter("xiangting");
		Userdao dao=new Userdao();
		response.setContentType("text/html");
		PrintWriter out = response.getWriter();
		if(dao.Pan(name))
		{
			out.println("用户"+name+"存在");
		}else
		{
			out.println("用户"+name+"不存在");
		}
		
		out.flush();
		out.close();
	}

	public void init() throws ServletException {
	}

}
